<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/login.css">
    <script src="${pageContext.request.contextPath}/js/jquery-2.1.0.js"></script>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <script src="../../../js/bootstrap.js"></script>
    <script type="text/javascript">


        $(function(){
            $("#login").click(function () {
                var adminName=$("#adminName").val();
                var adminPassword=$("#adminPassword").val();
                if (adminName == '' || adminPassword == ''){
                    alert("错误，用户名和密码出现错误！")
                    return;
                }
                $.ajax({
                    type:"POST",
                    url:"${pageContext.request.contextPath }/doLogin",
                    dataType:"text",
                    data:{
                        adminName:adminName,
                        adminPassword:adminPassword


                    },
                    success:function (data) {
                        if (data!=null){
                            alert("登录成功")
                            window.location.href="${pageContext.request.contextPath}/admin/index";
                        }
                    } ,error:function(){
                        alert("系统崩溃!")
                    }
                })
            })
        })
    </script>
</head>
<body>
<div>

    <div class="wrap">
        <div class="container-fluid" style="height: 100px;width: 100%">
            <div class="row">
                <div class="col-lg-10">
                    <span><img src="${pageContext.request.contextPath}/img/admin/logo.png" width="150px"> </span><span style="font-size: 30px"><spring:message code="titleS"/></span>
                </div>
                <div class="col-lg-2" style="padding-left: 80px">
                    <%--                     <input type="button" href="${pageContext.request.contextPath}/toEnglish?locale=en_US" value="English">--%>
                    <button style="width: 100px"> <a href="${pageContext.request.contextPath}/toChinese?locale=zh_CN" style="color: white">中文</a></button>
                    <button style="width: 100px"><a href="${pageContext.request.contextPath}/toEnglish?locale=en_US" style="color: white">English</a></button>
                </div>
            </div>

        </div>

        <article>
            <section>
                <aside>
                    <em>
                        <img src="${pageContext.request.contextPath}/img/user.png">
                    </em>
                    <p class="name" style="text-align: center"><i></i><input type="text" name="adminName" id="adminName"class="userName" placeholder="<spring:message code="nameS"/>"></p>
                    <p class="password"  style="text-align: center"><i></i><input type="password" name="adminPassword" id="adminPassword" class="pwd" placeholder="<spring:message code="passwords"/>"></p>
                    <div style="text-align: center">
                     <INPUT TYPE="submit" id="login" <spring:message code="loginS"/>>
                    </div>
                    <p class="remember" style="width: 300px"><input type="checkbox" name="remember"><spring:message code="toPassword"/></p>
                    <div class="clear"></div>
                </aside>
            </section>
        </article>
        <footer>
            <ul>
                <li><a href="#"><spring:message code="relation"/></a></li>
                <li><a href="#"><spring:message code="about"/></a></li>
                <li><a href="#"><spring:message code="talents"/></a></li>
                <li><a href="#"><spring:message code="friendship"/></a></li>
                <li><a href="#"><spring:message code="url"/></a></li>
                <li><a href="#"><spring:message code="attention"/></a></li>
            </ul>
            <p><spring:message code="pu"/></p>
        </footer>
    </div>
</div>
</body>
</html>
